Attribute VB_Name = "modFTPReadWriteText"
Public ftpHostname As String 'serverFTP
Public ftpUsername As String 'userID
Public ftpPassword As String 'Password
Public ftpremoteFolder As String 'remoteFolder

  
Public Function ReadFTPSetting(strPath As String)
    ' Get a free file number
    nFileNum = FreeFile
    Dim sText As String
    ' Open a text file for input. inputbox returns the path to read the file
    Open strPath For Input As nFileNum
        'lLineCount = 1
        ' Read the contents of the file
        Do While Not EOF(nFileNum)
            '========================================================
            Line Input #nFileNum, sNextLine
            ftpHostname = Mid(Trim(sNextLine), InStr(1, Trim(sNextLine), "=") + 1)
            Line Input #nFileNum, sNextLine
            ftpUsername = Mid(Trim(sNextLine), InStr(1, Trim(sNextLine), "=") + 1)
            Line Input #nFileNum, sNextLine
            ftpPassword = decodepass(Mid(Trim(sNextLine), InStr(1, Trim(sNextLine), "=") + 1))
            Line Input #nFileNum, sNextLine
            ftpremoteFolder = Mid(Trim(sNextLine), InStr(1, Trim(sNextLine), "=") + 1)
            '========================================================
        Loop
        ' Close the file
    Close nFileNum
    'ReadTextFile = sText
End Function

Public Function WriteFTPSetting(strPath As String)
    Open strPath For Output As #1 'nFileNum
        Print #1, "FTPHostname =" & ftpHostname
        Print #1, "FTPUsername =" & ftpUsername
        Print #1, "FTPPassword =" & ftpPassword
        Print #1, "FTPRemoteFolder =" & ftpremoteFolder
        ' Close the file
    Close #1
End Function


